
import * as ActionTypes from '../../../constants/constants.js'
import * as util from '../../../util/utils.js'


export const addressList = (state = [], action) => {
    switch (action.type) {
        case ActionTypes.addressList:
            return action.data
        case ActionTypes.addressListRefresh:
            return action.data
        case ActionTypes.addressListError:
            state.error = action.data.error
            return {
                ...state,
                ...action.data
            }
        case ActionTypes.addressListReset:
            return {
                pageNum: 0,
                nextPage: 1,
                pageSize: 10,
                list: []
            }
        default:
            return state;
    }
}

export const selectAddress = (state = null, action) => {
    switch (action.type) {
        case ActionTypes.selectAddress:
            return action.data
        default:
            return state;
    }
}


export const defaultAddress = (state = null, action) => {
    switch (action.type) {
        case ActionTypes.defaultAddress:
            return action.data
        default:
            return state;
    }
}

